<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<!-- 网页使用的语言 -->
<html lang="zh-CN">
<head>
    <!-- 指定字符集 -->
    <meta charset="utf-8">
    <!-- 使用Edge最新的浏览器的渲染方式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- viewport视口：网页可以根据设置的宽度自动进行适配，在浏览器的内部虚拟一个容器，容器的宽度与设备的宽度相同。
    width: 默认宽度与设备的宽度相同
    initial-scale: 初始的缩放比，为1:1 -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>用户信息管理系统</title>

    <!-- 1. 导入CSS的全局样式 -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!-- 2. jQuery导入，建议使用1.9以上的版本 -->
    <script src="js/jquery-2.1.0.min.js"></script>
    <!-- 3. 导入bootstrap的js文件 -->
    <script src="js/bootstrap.min.js"></script>
    <style type="text/css">
        td, th {
            text-align: center;
        }
    </style>
</head>
<body>
<div class="container">
    <h3 style="text-align: center">商品信息列表</h3>

    <div style="float: left;">

        <form class="form-inline" action="/goods?method=checkGoods&currentPage=1" method="post">
            <div class="form-group">
                <label for="exampleInputName2">商品名称</label>
                <input type="text" class="form-control" id="exampleInputName2" name="gname">
            </div>
            <%--            <div class="form-group">--%>
            <%--                <label for="exampleInputName3">状态</label>--%>
            <%--                <input type="text" class="form-control" id="exampleInputName3" name="flag">--%>
            <%--            </div>--%>

            <div class="form-group ">
                <label for="exampleInputName2">商品种类</label>
                <select name="gtype" class="form-control">
                    <option value="">查询所有</option>
                    <option value="饮料">饮料</option>
                    <option value="食品">食品</option>
                    <option value="冷品">冷品</option>
                    <option value="零食">零食</option>
                    <option value="衣服">衣服</option>
                    <option value="日常用品">日常用品</option>
                </select>
            </div>



            <button type="submit" class="btn btn-default">查询</button>
        </form>

    </div>

    <div style="float: right;margin: 5px;">

        <%--<a class="btn btn-primary" href="add.html">添加联系人</a>--%>
        <%--<a class="btn btn-primary" href="add.html">删除选中</a>--%>

    </div>

    <table border="1" class="table table-bordered table-hover">
        <tr class="success">



            <th>商品编号</th>
            <th>商品名称</th>
            <th>商品价格</th>
            <th>库存</th>
            <th>种类</th>
            <th>操作</th>
        </tr>

        <c:forEach items="${Goods.list}" var="goods" varStatus="s">
            <tr>
                <td>${goods.id}</td>
                <td>${goods.gname}</td>
                    <%--                <td>${songlist.pic}</td>--%>
                    <%--                <td>${songlist.introduction}</td>--%>
                <td>${goods.price}元</td>
                <td>${goods.number}个</td>
                <td>${goods.gtype}</td>


                <td>
                    <a class="btn btn-default btn-sm" href="${pageContext.request.contextPath}/goods?method=goodsById&gid=${goods.id}">修改</a>&nbsp;
                    <a class="btn btn-default btn-sm" href="${pageContext.request.contextPath}/goods?method=deleteGoods&currentPage=1&gid=${goods.id}">下架</a></td>
            </tr>
        </c:forEach>


    </table>
    <div>
        <nav aria-label="Page navigation">
            <ul class="pagination">
                <li>
                    <a href="${pageContext.request.contextPath}/goods?method=showAll&currentPage=${Goods.currentPage-1}" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                <c:forEach begin="1" end="${Goods.totalPage}" var="i">
                    <c:if test="${Goods.currentPage==i}">
                        <li class="active">
                            <a href="${pageContext.request.contextPath}/goods?method=showAll&currentPage=${i}">${i}</a>
                        </li>
                    </c:if>
                    <c:if test="${Goods.currentPage!=i}">
                        <li>
                            <a href="${pageContext.request.contextPath}/goods?method=showAll&currentPage=${i}">${i}</a>
                        </li>
                    </c:if>
                </c:forEach>
                <li>
                    <a href="${pageContext.request.contextPath}/goods?method=showAll&currentPage=${Goods.currentPage+1}" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
                <span style="font-size: 25px;margin-left: 5px;">
                    共${Goods.totalCount}条记录，共${Goods.totalPage}页
                </span>
            </ul>
        </nav>
    </div>
</div>
</body>
</html>
